package com.jun.seckill_by_jun.service;

import com.jun.seckill_by_jun.dao.TestDao;
import com.jun.seckill_by_jun.domain.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class TestService {
    @Autowired
    private TestDao testDao;

    public int insert(Test test){
        int i = testDao.insert(test);
        return i;
    }

    public Test getTestById(int id){
        Test ans = testDao.getTestById(id);
        return ans;
    }

    @Transactional
    public boolean transactionTest(){
        testDao.insert(new Test(2,"111"));
        testDao.insert(new Test(1,"111"));
        return true;
    }
}
